void  verlet(caja *bx,double Dt)
{
	double posNew[3], dr;
	int index =0;
	for(int i=0;i<bx->npart;i++)
	{
//		if(i==index)
//		{
//			cout<<"Vold: "<<bx->part[i].vel[0]<<"  "<<bx->part[i].vel[1]<<"  "<<bx->part[i].vel[2]<<endl;
//		}
		for (int j=0;j<3;j++)
		{
			posNew[j]=(bx->part[i].pos[j])+(bx->part[i].vel[j])*Dt+(bx->part[i].force[j])*Dt*Dt/2.0;
			dr=posNew[j]-(bx->part[i].posOld[j]);
			//dr-=round(dr/(bx->lbox[j]))*(bx->lbox[j]);
			dr-=int(dr/(0.5*(bx->lbox[j])))*(bx->lbox[j]);
			bx->part[i].vel[j]=(dr)/(2.0*Dt);
			bx->part[i].posOld[j]=bx->part[i].pos[j];
			bx->part[i].pos[j]=posNew[j];
			//cout<<bx->part[i].vel[j]<<"  ";
			//if(bx->part[i].vel[j]>1000.0)
			//	cout<<"***************** "<<bx->part[i].vel[j]<<endl;
		}
//		if(i==index)
//		{
//			cout<<"Vnew: "<<bx->part[i].vel[0]<<"  "<<bx->part[i].vel[1]<<"  "<<bx->part[i].vel[2]<<endl;
//		}
		//cout<<endl;
		bx->boundary(i);
	}

}

void  randomMovement(caja *bx,double Dt)
{
	for(int i=0;i<bx->npart;i++)
	{
		for (int j=0;j<3;j++)
		{
			bx->part[i].pos[j]+=Dt*(double(rand())/RAND_MAX-0.5);
		}
		bx->boundary(i);
	}

}
